<template>
  <!-- 订单上传双签合同页面 -->
  <div class="order-contract">
    <div class="step">
      <t-steps :current="current" :steps="steps" />
    </div>
    <div class="order">
      <keep-alive>
        <t-order v-if="current == 0" @onStepChange="onStepChange"
      /></keep-alive>
    </div>
    <div class="upload-double-sign">
      <u-sign
        v-if="current == 1"
        :page="curpage"
        @onStepChange="onStepChange"
      />
    </div>
    <div class="result-page">
      <result-page
        :datas="datas"
        :pages="'orderPage'"
        v-if="current == 2"
        :title="'成功生成合同'"
        @onStepChange="onStepChange"
      />
    </div>
  </div>
</template>
<script>
import tSteps from "../components/steps";
import tOrder from "../components/associated-order";
import uSign from "../components/double-sign-m";
import resultPage from "../components/result-page";
import { getquotations } from "@/api/quotation";

const steps = [
  {
    title: "关联订单"
  },
  {
    title: "核实合同"
  },
  {
    title: "完成"
  }
];

export default {
  components: {
    tSteps,
    tOrder,
    uSign,
    resultPage
  },
  data() {
    return {
      curpage: "orderContractPage",
      current: 0,
      submitLoading: false,
      datas: [],
      imgFileList: [],
      form: {
        type: "销售"
      },
      steps
    };
  },
  watch: {},
  created() {},
  methods: {
    onStepChange(val, callback, imgFileList) {
      if (callback) this.datas = callback;
      if (imgFileList) this.imgFileList = imgFileList;
      this.current = val;
    },
    getContractDetail() {
      this.loading = true;
      getquotations({
        searchKey: this.searchKey,
        pageData: {
          pageNum: this.pageNum,
          pageSize: 20
        }
      })
        .then(res => {
          this.data = res;
        })
        .finally(() => {
          this.loading = false;
        });
    },
    pageChange(pagination) {
      this.pageNum = pagination;
    }
  },
  beforeDestroy() {
    this.$storage.s_remove("createContractparams");
    this.$storage.s_remove("createContractOrder");
  }
};
</script>

<style lang="scss" scoped>
.order-contract {
  background: #fff;
  .upload-double-sign {
    padding: 0 30px;
  }

  .step {
    padding: 50px;
  }
}
</style>
